//
//  PhotoView.m
//  项目1 CLCMovie
//
//  Created by huiwenjiaoyu on 15/7/23.
//  Copyright (c) 2015年 CLC. All rights reserved.
//

#import "PhotoView.h"

@interface PhotoView ()

@end

@implementation PhotoView

- (void)viewDidLoad {
    [super viewDidLoad];
    [self _creatCollectionView];

    [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(hideNavigationBar) name:@"HideNavigationBarNotification" object:nil];
    
}

//接收通知隐藏Bar(未完成)
- (void)hideNavigationBar
{

    BOOL isHidden = self.navigationController.navigationBar.hidden;
    if (isHidden)
        isHidden =! isHidden;
    [self.navigationController setNavigationBarHidden:isHidden animated:YES];
}

- (void)_creatCollectionView
{
    //layout设置
    UICollectionViewFlowLayout* layout = [[UICollectionViewFlowLayout alloc] init];
    layout.itemSize = self.view.bounds.size;
    [layout setScrollDirection:UICollectionViewScrollDirectionHorizontal];
    [layout setMinimumLineSpacing:0];
    

    _collectionView = [[PhotoCollectionView alloc] initWithFrame:self.view.bounds collectionViewLayout:layout];
    _collectionView.index = self.index;
    
    _collectionView.pagingEnabled = YES;

    _collectionView.dataArray = self.dataArray;
    [self.view addSubview:_collectionView];
    
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
